#include"TcpServer.hpp"
#include<memory>

void Usage(const std::string &proc)
{
    // 0 ~ 1023是系统保留端口，用户或应用程序可配置端口选 1024及以上
    std::cout << "\nUsage: " << proc << " port[1024+]\n" << std::endl;
}

// ./tcpserver tcpserver_port
int main(int argc, char *argv[])
{
    if(argc != 2)
    {
        Usage(argv[0]);
        exit(UsageError);
    }
    uint16_t port = std::stoi(argv[1]);
    lg.Enable(Classfile);
    std::unique_ptr<TcpServer> tcp_svr(new TcpServer(port));
    tcp_svr->InitServer();
    tcp_svr->Start();
    
    return 0;
}